package pers.zh.parking.data.entity;

import android.os.Parcel;
import android.os.Parcelable;

public class ParkingSpace implements Parcelable {
    private Integer spaceId;

    private Integer spaceNo;

    private Integer lotId;

    private String status;

    private boolean toDel;

    public Integer getSpaceId() {
        return spaceId;
    }

    public void setSpaceId(Integer spaceId) {
        this.spaceId = spaceId;
    }

    public Integer getSpaceNo() {
        return spaceNo;
    }

    public void setSpaceNo(Integer spaceNo) {
        this.spaceNo = spaceNo;
    }

    public Integer getLotId() {
        return lotId;
    }

    public void setLotId(Integer lotId) {
        this.lotId = lotId;
    }

    public String getStatus() {
        return status == null ? "" : status;
    }

    public String getStatusCh() {
        switch (status) {
            case "1":
                return "空闲";
            case "2":
                return "在用";
            case "3":
                return "预约中";
            default:
                return "未知";
        }
    }

    public void setStatus(String status) {
        this.status = status == null ? null : status.trim();
    }

    @Override
    public int describeContents() { return 0; }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeValue(this.spaceId);
        dest.writeValue(this.spaceNo);
        dest.writeValue(this.lotId);
        dest.writeString(this.status);
    }

    public ParkingSpace() {}

    protected ParkingSpace(Parcel in) {
        this.spaceId = (Integer)in.readValue(Integer.class.getClassLoader());
        this.spaceNo = (Integer)in.readValue(Integer.class.getClassLoader());
        this.lotId = (Integer)in.readValue(Integer.class.getClassLoader());
        this.status = in.readString();
    }

    public static final Parcelable.Creator<ParkingSpace> CREATOR = new Parcelable.Creator<ParkingSpace>() {
        @Override
        public ParkingSpace createFromParcel(Parcel source) {return new ParkingSpace(source);}

        @Override
        public ParkingSpace[] newArray(int size) {return new ParkingSpace[size];}
    };

    public boolean isToDel() {
        return toDel;
    }

    public void setToDel(boolean toDel) {
        this.toDel = toDel;
    }

}